/*
 * @Author       : NaN 353362604@qq.com
 * @Date         : 2023-07-05 14:09:42
 * @LastEditTime : 2023-07-05 15:11:49
 * @LastEditors  : NaN 353362604@qq.com
 * @FilePath     : \AdminStration\src\Common\Router\MenuNav\TwoRouter\ProjectSetUp.jsx
 * @Description  :
 */
import { API_LIST } from '../../../Api/Api'
import { commonTableList, BuiltInData } from '../Common/common'
import { AddDataButton, DelDataButton } from '../Common/options'

export const ProjectSetUp = async ({ OptionsEvent, oneData, Permission }) => {
    let dataList = {
        hideInSearch: true,
        pageSize: 10,
        initialValues: { organizationUuid: oneData.organizationUuid },
        params: { pageIndex: 1, OrganizationUuid: oneData.organizationUuid },
        get: API_LIST([oneData.uuid])['getProjectMenu'],
        added: 'posProjectMenu',
        options: [
            Permission.findIndex(v => v.uuid === '0d944810-a7e9-412f-a9cb-f2bc11a6a7b6') !== -1 && (
                <AddDataButton OptionsEvent={OptionsEvent} type="primary" icon="add" title="添加菜单" />
            ),
        ],
        columns: [
            commonTableList.uuid,
            {
                dataIndex: 'organizationUuid',
                title: 'organizationUuid',
                valueType: 'hidden',
                hideInTable: true,
            },
            { ...commonTableList.tableName, title: '菜单名称' },
            {
                dataIndex: 'url',
                title: '菜单路径',
                valueType: 'select',
                valueEnum: BuiltInData.ProjectMenuList,
                rules: true,
                width: 150,
            },
            { ...commonTableList.sortId },
            {
                title: '操作',
                valueType: 'systemOperation',
                fixed: 'right',
                width: 220,
                hideInSearch: true,
                hideInAdded: true,
                hideInModify: true,
                render: (_, record) => {
                    return [
                        Permission.findIndex(v => v.uuid === '198184c7-d613-460a-b349-c3fd04db4e19') !== -1 && (
                            <DelDataButton
                                OptionsEvent={OptionsEvent}
                                key="del"
                                title="删除"
                                url="ProjectMenu"
                                uuid={record.uuid}
                            />
                        ),
                    ]
                },
            },
        ],
    }
    return dataList
}
